home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / tools / czesc_3 / multiuser / extern / netmufs1.1 / accounts / accountslib.c < prev    next >
C/C++ Source or Header  |  1994-03-07  |  2KB  |  74 lines

  1. /*
  2. **    $VER: accountslib.c 1.3 (08.02.94)
  3. **
  4. **    accounts.library standard functions
  5. **
  6. **    © Copyright 1994 by Norbert Püschel
  7. **    All Rights Reserved
  8. */
  9.  
  10. #include <proto/exec.h>
  11. #include <proto/dos.h>
  12.  
  13. #include <dos/dostags.h>
  14.  
  15. #include <debug.h>
  16.  
  17. struct DosLibrary *DOSBase;
  18.  
  19. volatile struct Process *guardian = 0;
  20.  
  21. extern void guardian_func(void);
  22.  
  23. BOOL __saveds __asm LIBLocalAlloc(register __d0 struct Library *Base)
  24.  
  25. {
  26.   if(guardian == 0) { /* restart guardian process */
  27.     guardian = CreateNewProcTags(NP_Entry,guardian_func,
  28.                                  NP_Name,"Accounts Daemon",
  29.                                  NP_Priority,0,
  30.                                  NP_WindowPtr,-1,
  31.                                  TAG_DONE);
  32.     if(guardian) {
  33.       debug("Guardian started\n");
  34.       if(DoPkt0(&(((struct Process *)guardian)->pr_MsgPort),0)) return(TRUE);
  35.       debug("Guardian failed\n");
  36.     }
  37.     return(FALSE);
  38.   }
  39.   return(TRUE);
  40. }
  41.  
  42. BOOL __saveds __asm LIBLocalFree(register __d0 struct Library *Base) 
  43.  
  44. {
  45.   return(TRUE);
  46. }
  47.  
  48. BOOL __saveds __asm LIBGlobalAlloc(register __d0 struct Library *Base)
  49.  
  50. {
  51.   DOSBase = (struct DosLibrary *)OpenLibrary("dos.library",37);
  52.   if(DOSBase) {
  53.     debug("dos.library opened\n");
  54.     return(TRUE);
  55.   }
  56.   debug("dos.library could not be opened\n");
  57.   return(FALSE);
  58. }
  59.  
  60. BOOL __saveds __asm LIBGlobalFree(register __d0 struct Library *Base) 
  61.  
  62. {
  63.   if(guardian) {
  64.     debug("Trying to kill guardian ...\n");
  65.     Signal((struct Task *)guardian,SIGBREAKF_CTRL_C);
  66.     return(FALSE);
  67.   }
  68.  
  69.   debug("Expunging accounts.library\n");
  70.  
  71.   CloseLibrary((struct Library *)DOSBase);
  72.   return(TRUE);
  73. }
  74.